package com.e2oto.seller.modules.seller.presenter;

import com.alibaba.fastjson.JSONObject;
import com.e2oto.seller.common.EasyAES;
import com.e2oto.seller.common.base.BaseBean;
import com.e2oto.seller.common.base.BasePresenter;
import com.e2oto.seller.common.http.ProgressSubscriber;
import com.e2oto.seller.common.http.ProgressSubscriberOnNextListener;
import com.e2oto.seller.common.utils.RetrofitUtils;
import com.e2oto.seller.modules.SellerApp;
import com.e2oto.seller.modules.seller.bean.GoodsCategoryBean;
import com.e2oto.seller.modules.seller.views.GoodsManageView;

import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by ZhangLiQiang on 2017/11/28.
 */

public class GoodsManagePresenter extends BasePresenter<GoodsManageView> {

    /***
     * 拿批发商品列表
     */
    public void getBatchGoodsList() {

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("seller_id", SellerApp.sellerId);
        String param = EasyAES.encrypt(jsonObject);


        RetrofitUtils.getApiService().getGoodsList(param, SellerApp.versionName)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ProgressSubscriber(new ProgressSubscriberOnNextListener<List<GoodsCategoryBean>>() {
                    @Override
                    public void onNext(List<GoodsCategoryBean> list) {
                        getView().getCategoryListCallback(list);
                    }
                }, getContext()));
    }


        /***
         * 拿零售商品列表
         */

    public void getGoodsList() {

    }

}
